<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/10/28
  Time: 14:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="script/jquery-3.6.0.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#getJson").click(function () {
                // console.log("ok")
                var url=this.href;
                var args= {"time":new Date()};
                $.post(
                    url,
                    args,
                    function (data) {
                        console.log("data=",data)
                        console.log("data.name=",data.name)
                        console.log("data.host=",data.host)
                    },
                    "json"
                )
                return false;
            })
        })
    </script>
</head>
<body>

<h1>请求一个cat json数据</h1>
<a href="<%=request.getContextPath()%>/cat" id="getJson">点击获取json数据</a>
</body>
</html>
